package edu.sias.hyznxfapi.controller;


import edu.sias.hyznxfapi.textModification.textTranslation.WebITS;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/xfapi/translation")
public class TranslationController {
    @GetMapping("/{text}/{from}/{to}")
    public String translationText(@PathVariable("text") String text,@PathVariable("from") String from,@PathVariable("to") String to) throws Exception {
        String translation = new WebITS().getTranslation(text,from,to);
        System.out.println("翻译结果：" + translation);
        return translation;
    }
}
